'''
Author        zzx
Date          2024-07-22 16:43:02
LastEditTime  2024-09-24 16:00:19
LastEditors   zzx
Description   功能描述
'''
# -*- encoding: utf-8 -*-

from app.extensions.sqlalchemy import db, EntityModel as Base

class ServersInfo(Base):

    __tablename__ = 'servers_info'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    name = db.Column(db.String(255), comment='服务器名称')
    ip = db.Column(db.String(255), comment='服务器ip')
    servers_id = db.Column(db.String(32), nullable=False, comment='服务器id')

    def to_dict(self, output_fields=(), exclude_fields=()):
        res = super().to_dict(output_fields=output_fields, exclude_fields=exclude_fields)

        file_fields = ['file_path', 'file_small_path']
        res.update(self.get_loc_file_url(file_fields))
        return res

    def list_to_dict(self, *args, **kwargs):
        res = self.to_dict(*args, **kwargs)
        return res

